import request from "@/utils/request";

// 查询资产列表
export function listInterface(query) {
  return request({
    url: "/system/apiinterface/list",
    method: "get",
    params: query,
  });
}
//限流
export function limitFlow(data) {
  return request({
    url: "/system/apiinterface/limitFlow",
    method: "post",
    data: data,
  });
}
//敏感字段
export function querySensitiveList(id) {
  return request({
    url: "/system/apiinterface/querySensitiveList",
    method: "get",
    params: id,
  });
}

//数据分级
export function queryLevelList(id) {
  return request({
    url: "/system/apiinterface/queryLevelList",
    method: "get",
    params: id,
  });
}

//数据类别
export function queryTypeList(id) {
  return request({
    url: "/system/apiinterface/queryTypeList",
    method: "get",
    params: id,
  });
}

//标签管理
export function queryTagList(id) {
  return request({
    url: "/system/apiinterface/queryTagList",
    method: "get",
    params: id,
  });
}

// 查询资产详细
export function getInterface(id) {
  return request({
    url: "/system/apiinterface/getInfo",
    method: "get",
    params: id,
  });
}

export function listSensitive(params) {
  return request({
    url: "/system/apiinterface/listSensitive",
    method: "get",
    params,
  });
}

export function queryDataTypeTreeList(data) {
  return request({
    url: "/system/apiinterface/queryTypeTreeList",
    method: "get",
    params: data,
  });
}
// 新增资产
export function addInterface(data) {
  return request({
    url: "/system/apiinterface/add",
    method: "post",
    data: data,
  });
}

export function getIp(data) {
  return request({
    url: "/system/apiinterface/getIp",
    method: "get",
    params: data,
  });
}

//人工确定
export function manualReview(data) {
  return request({
    url: "/system/apiinterface/manualReview",
    method: "post",
    data: data,
  });
}

// 编辑资产
export function updateInterface(data) {
  return request({
    url: "/system/apiinterface/edit",
    method: "post",
    data: data,
  });
}

// 批量上线、下线
export function batchEdit(data) {
  return request({
    url: "/system/apiinterface/batchEdit",
    headers: {
      "Content-Type": "multipart/form-data",
    },
    method: "post",
    data,
  });
}

export function queryApiUrlList(params) {
  return request({
    url: "/system/applicationManage/queryApiUrlList",
    method: "get",
    params,
  });
}

// 删除资产
export function delInterface(data) {
  return request({
    url: "/system/apiinterface/remove",
    method: "post",
    data,
  });
}

export function batchUpdate(data) {
  return request({
    url: "/system/apiinterface/batchUpdate",
    method: "post",
    data: data,
  });
}

// 资产分组
export function treeselect(params) {
  return request({
    url: "/system/apiinterface/groupTree",
    method: "get",
    params,
  });
}

// 敏感标识下拉列表
export function getSensitiveRule(params) {
  return request({
    url: "/system/apiinterface/getSensitiveRule",
    method: "get",
    params,
  });
}

// 查询资产分析 流量分析
export function getAnalysisUpData(params) {
  return request({
    url: "/system/apiinterface/flowAnalysis",
    method: "get",
    params,
  });
}

export function getAnalysisDownData(params) {
  return request({
    url: "/system/apiinterface/flowDownAnalysis",
    method: "get",
    params,
  });
}

// 查询资产分析 访问量
export function getAccessFlow(data) {
  return request({
    url: "/system/apiinterface/getInterfaceVisits",
    method: "post",
    data,
  });
}

// 查询资产分析 错误分布
export function getErrorData(params) {
  return request({
    url: "/system/apiinterface/getErrorData",
    method: "get",
    params,
  });
}

//分配组织
export function updateDeptId(data) {
  return request({
    url: "/system/apiinterface/updateDeptId",
    method: "post",
    data,
  });
}

export function fetchHttpsList(params) {
  return request({
    url: "/system/httpsapiinterface/listHttps",
    method: "get",
    params,
  });
}

export function fetchWeekVisitCounts(data) {
  return request({
    url: "/system/httpsapiinterface/get7daysVisistsByIp",
    method: "post",
    data,
  });
}

export function fetchSftpList(params) {
  return request({
    url: "/system/api/apiinterface/listSftp",
    method: "get",
    params,
  });
}

export function fetchUrlDetail(data) {
  return request({
    url: "/system/apiinterface/getUrlDetail",
    method: "post",
    data,
  });
}

// export function listByOrg(data) {
//   return request({
//       url: '/apisecurity/apiinterface/listByOrg',
//       method: 'get',
//       params: data
//   })
// }

export function getApplicationManageName(params) {
  return request({
    url: "/system/applicationManage/getApplicationManageName",
    method: "get",
    params,
  });
}

export function insert(data) {
  return request({
    url: "/system/businessSystem/insert",
    method: "post",
    data,
  });
}

export function manualCoreReview(data) {
  return request({
    url: "/system/apiinterface/manualCoreReview",
    method: "post",
    data,
  });
}
export function manualImportData(data) {
  return request({
    url: "/system/apiinterface/manualTagReview",
    method: "post",
    data,
  });
}
export function manualTypeReview(data) {
  return request({
    url: "/system/apiinterface/manualTypeReview",
    method: "post",
    data,
  });
}
export function manualRuleReview(data) {
  return request({
    url: "/system/apiinterface/manualRuleReview",
    method: "post",
    data,
  });
}

export function getApiInterfaceList(params) {
  return request({
    url: "/system/api/statisreport/getApiInterfaceList",
    method: "get",
    params,
  });
}

export function queryApiDeail(params) {
  return request({
    url: "/system/visitLogSource/queryApiDeail",
    method: "get",
    params,
  });
}
